package flc.ast.adapter;

import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;
import stark.common.bean.StkResBean;

public class MovieHotSearchAdapter extends StkProviderMultiAdapter<StkResBean> {

    public MovieHotSearchAdapter() {
        addItemProvider(new StkSingleSpanProvider(126));
        addItemProvider(new MovieHotSearchProvider());
    }

    private class MovieHotSearchProvider extends BaseItemProvider<StkResBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_movie_hot_search;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, StkResBean bean) {
            baseViewHolder.setText(R.id.tvMovieHotSearchItemName, bean.getName());
            if (baseViewHolder.getBindingAdapterPosition() == 0) {
                baseViewHolder.setImageResource(R.id.ivMovieHotSearchItemIcon, R.drawable.rmss1);
                baseViewHolder.getView(R.id.ivMovieHotSearchItemIcon).setVisibility(View.VISIBLE);
            } else if (baseViewHolder.getBindingAdapterPosition() == 1) {
                baseViewHolder.setImageResource(R.id.ivMovieHotSearchItemIcon, R.drawable.rmss2);
                baseViewHolder.getView(R.id.ivMovieHotSearchItemIcon).setVisibility(View.VISIBLE);
            } else if (baseViewHolder.getBindingAdapterPosition() == 2) {
                baseViewHolder.setImageResource(R.id.ivMovieHotSearchItemIcon, R.drawable.rmss3);
                baseViewHolder.getView(R.id.ivMovieHotSearchItemIcon).setVisibility(View.VISIBLE);
            } else {
                baseViewHolder.getView(R.id.ivMovieHotSearchItemIcon).setVisibility(View.INVISIBLE);
            }
        }
    }

}
